package com.boomsecret.demo;

import com.boomsecret.domain.TransientDomain;

import java.io.*;

/**
 * Created by jack on 2018/1/10.
 */
public class TransientDemo {
    public static void main(String[] args) throws Exception {
        TransientDomain transientDomain = new TransientDomain();
        transientDomain.setKeyOne("valueOne");
        transientDomain.setKeyTwo("valueTwo");

        File targetFile = new File("temp3.txt");
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(targetFile));
        oos.writeObject(transientDomain);
        oos.flush();
        oos.close();

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(targetFile));
        TransientDomain newTransientDomain = (TransientDomain) ois.readObject();
        ois.close();
        System.out.println(newTransientDomain);
    }
}
